package com.yly.input.demo.business;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yly.input.demo.bo.ElderBO;
import com.yly.input.demo.converter.BusinessConverter;
import com.yly.input.demo.repository.entity.Elder;
import com.yly.input.demo.repository.mapper.ElderMapper;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
public class ElderBusiness extends ServiceImpl<ElderMapper, Elder> {

    private final BusinessConverter businessConverter;

    @Autowired
    public ElderBusiness(BusinessConverter businessConverter) {
        this.businessConverter = businessConverter;
    }

    public List<ElderBO> getElders() {
        List<Elder> re = this.baseMapper.getList();
        return businessConverter.toElderBOList(re);
    }
}
